﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;
using System.Drawing;

namespace CoolEngine.Gui.New
{
    public class NewLabel:GraphicsDeviceControl
    {
        SpriteFont font;
        ContentManager content;
        SpriteBatch batch;
        //public string Text { get; set; }
        public Vector2 Position { get; set; }
        public Microsoft.Xna.Framework.Graphics.Color Colour { get; set; }
        protected override void Initialize()
        {
            content = new ContentManager(Services, "Content");
            batch = new SpriteBatch(GraphicsDevice);
            font = content.Load<SpriteFont>("Fonts\\Calibri");
        }

        protected override void Draw()
        {
            batch.Begin();
            batch.DrawString(font, Text, Position, Colour);
            batch.End();
        }
        protected override void PaintUsingSystemDrawing(System.Drawing.Graphics graphics, string text)
        {
            graphics.Clear(System.Drawing.Color.CornflowerBlue);

            using (Brush brush = new SolidBrush(System.Drawing.Color.Black))
            {
                using (StringFormat format = new StringFormat())
                {
                    format.Alignment = StringAlignment.Center;
                    format.LineAlignment = StringAlignment.Center;

                    graphics.DrawString(Text, Font, brush, ClientRectangle, format);
                }
            }
        }
    }
}
